<template>
  <div class="app-container">
    <div class="head-container">
      <div>
        <!-- 搜索 -->
        <el-input
          v-model="query.keywords"
          clearable
          size="small"
          placeholder="请输入关键词"
          style="width: 200px;"
          class="filter-item"
        />
        <el-input
          v-if="false"
          v-model="query.taskId"
          clearable
          size="small"
          style="width: 200px;"
          class="filter-item"
        />
        <el-input
          v-model="query.mediaPlatformId"
          clearable
          size="small"
          placeholder="请输入发布账号"
          style="width: 200px;"
          class="filter-item"
        />
        <date-range-picker v-model="query.publishDate" class="date-item" />
        <el-select
          v-model="query.projectName"
          clearable
          size="small"
          placeholder="项目"
          class="filter-item"
          style="width: 200px"
        >
          <el-option
            v-for="item in projectOptions"
            :key="item.key"
            :label="item.display_name"
            :value="item.key"
          />
        </el-select>
        <rrOperation />
      </div>
    </div>
    <!--表格渲染-->
    <el-table ref="table" v-loading="crud.loading" :height="height" border :data="crud.data" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
      <el-table-column :show-overflow-tooltip="true" prop="keywords" label="关键词" />
      <el-table-column :show-overflow-tooltip="true" prop="bookId" label="书籍ID">
        <template slot-scope="scope">
          {{ scope.row.book?scope.row.book.bookId: '' }}
        </template>
      </el-table-column>
      <el-table-column :show-overflow-tooltip="true" prop="bookName" label="书籍名称">
        <template slot-scope="scope">
          {{ scope.row.book?scope.row.book.bookName: '' }}
        </template>
      </el-table-column>
      <el-table-column :show-overflow-tooltip="true" prop="userId" label="用户ID">
        <!-- <template slot-scope="scope">
          {{ scope.row.user?scope.row.user.userId: '' }}
        </template> -->
      </el-table-column>
      <el-table-column :show-overflow-tooltip="true" prop="phone" label="手机号">
        <template slot-scope="scope">
          {{ scope.row.user?scope.row.user.phone: '' }}
        </template>
      </el-table-column>
      <el-table-column :show-overflow-tooltip="true" prop="phone" label="邀请人" />
      <el-table-column :show-overflow-tooltip="true" prop="feedbackTime" label="回填时间" />
      <el-table-column :show-overflow-tooltip="true" prop="feedbackLink" label="回填链接" />
      <el-table-column :show-overflow-tooltip="true" prop="mediaPlatformId" label="发布账号" />
      <el-table-column :show-overflow-tooltip="true" prop="publishDate" label="发布日期" />
    </el-table>
    <pagination />
  </div>
</template>

<script>
import crudTask from '@/api/task'
import CRUD, { presenter, header, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import pagination from '@crud/Pagination'
import DateRangePicker from '@/components/DateRangePicker'
import { mapGetters } from 'vuex'
export default {
  name: 'Goods',
  components: { rrOperation, pagination, DateRangePicker },
  cruds() {
    return CRUD({ title: '回填作品', url: 'api/feedbackWork', crudMethod: { ...crudTask }})
  },
  mixins: [presenter(), header(), crud()],
  // 数据字典
  data() {
    return {
      height: document.documentElement.clientHeight - 180 + 'px;',
      projectOptions: [
        { key: '0', display_name: 'QQ阅读推文' },
        { key: '1', display_name: '知乎推文' }
      ]
    }
  },
  computed: {
    ...mapGetters([
      'user'
    ])
  },
  created() {
    this.crud.query.taskId = this.$route.query.id
    this.crud.toQuery()
  },
  mounted: function() {
    const that = this
    window.onresize = function temp() {
      that.height = document.documentElement.clientHeight - 180 + 'px;'
    }
  },
  methods: {
  }
}
</script>

      <style rel="stylesheet/scss" lang="scss" scoped>
        .head-container {
          display: flex;
          justify-content: space-between;
        }

      </style>

